#include "log_utils.h"
#include <fstream>
#include <ctime>

void write_log(const std::string& message) {
    std::ofstream logFile("server.log", std::ios::app);
    if (!logFile.is_open()) return;

    std::time_t now = std::time(nullptr);
    char timebuf[64];
    std::strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", std::localtime(&now));
    logFile << "[" << timebuf << "] " << message << std::endl;

    logFile.close();
}


